﻿#region Using

using System.Collections.Generic;

using GameLogic.External;

#endregion

namespace GameLogic.Internal
{

    #region Using

    #endregion

    internal abstract class Building : GameEntity, IBuilding
    {
        protected readonly Queue<Farmer> FarmerQueue;

        protected Building(Tile tile, BuildingType type)
        {
            this.Tile = tile;
            this.ProgressTimer = new ProgressTimer();
            this.FarmerQueue = new Queue<Farmer>();
            this.BuildingType = type;
        }

        protected ProgressTimer ProgressTimer { get; private set; }

        protected Tile Tile { get; private set; }

        public BuildingType BuildingType { get; private set; }

        public float CurrentProgress
        {
            get
            {
                return this.ProgressTimer.Progress;
            }
        }

        public int WaitingFarmers
        {
            get
            {
                return this.FarmerQueue.Count;
            }
        }

        internal abstract void Update(GameTime gameTime);

        internal abstract void Reset();

        internal void TakeFarmer(Farmer farmer)
        {
            this.FarmerQueue.Enqueue(farmer);
        }
    }
}